package main

import "fmt"

func main() {
	fmt.Println(DiffArray([]string{"orderer-0-baas2", "orderer-1-baas2"},
		[]string{"orderer-0-baas2", "orderer-1-baas2", "orderer-2-baas2"}))

	a := make(map[int]string, 0)
	a[1] = "1"
	a[2] = "2"
	a[3] = "3"
	a[4] = "4"
	fmt.Println(a[4] == "")
	delete(a, 1)
	delete(a, 2)
	delete(a, 3)
	fmt.Println(a)
}

// shuzu
func DiffArray(slice1, slice2 []string) []string {
	m := make(map[string]bool)
	diff := make([]string, 0)
	same := ContainArray(slice1, slice2)

	for _, v := range same {
		m[v] = true
	}

	for _, v := range slice1 {
		if m[v] != true {
			diff = append(diff, v)
		}
	}
	for _, v := range slice2 {
		if m[v] != true {
			diff = append(diff, v)
		}
	}
	return diff
}

func ContainArray(slice1, slice2 []string) []string {
	m := make(map[string]bool)
	result := make([]string, 0)
	for _, v := range slice1 {
		m[v] = true
	}
	for _, v := range slice2 {
		if m[v] == true {
			result = append(result, v)
		}
	}
	return result
}